﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ManageFile.ascx.vb" Inherits="WebForm_ManageDownload_ManageFile" %>
<div align="center">
    <asp:Label ID="lblTitle" runat="server" Text="<%$ Resources:Title %>" SkinID="title"></asp:Label>
</div>
<table width="100%">
    <tr>
        <td>
            <table id="table1" runat="server" border="0" style="width: 100%;" align="right">
                <tr>
                    <td width="15%" align="right">
                        <asp:Label ID="lblDefaultRole" runat="server" Text="<%$ Resources:DefaultRole %>"></asp:Label>
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlDefaultRole" runat="server" DataSourceID="SqlDataSource1"
                            DataTextField="RoleName" DataValueField="RoleID">
                        </asp:DropDownList>
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connStr %>"
                            SelectCommand="
SELECT B.RoleID,RoleName
FROM UserRoleAuth A
inner join Role B on A.RoleID=B.RoleID
WHERE A.UserID=@UserID And B.Active='Y'
">
                            <SelectParameters>
                                <asp:Parameter Name="UserID" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </td>
                </tr>
                <tr>
                    <td width="15%" align="right">
                        <asp:Label ID="Label1" runat="server" Text="<%$ Resources:File %>"></asp:Label>
                    </td>
                    <td>
                        <asp:FileUpload ID="hiFileUpload" runat="server" Width="70%" />
                        &nbsp;<asp:Button ID="Button1" runat="server" Text="<%$ Resources:Add %>" />
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <asp:Label ID="Label2" runat="server" Text="<%$ Resources:Desc %>"></asp:Label>
                    </td>
                    <td>
                        <asp:TextBox ID="txtDesc" runat="server" Rows="3" TextMode="MultiLine" Width="95%"></asp:TextBox>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td>
            <My:MyGridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="FileSaveName"
                EmptyDataText="<%$ Resources:NoFiles %>" Width="100%" AllowPaging="True" AllowSorting="True"
                DataSourceID="ObjectDataSource1" SkinID="pager" AllowHoverEffect="False" AllowHoverSelect="False"
                MySortDirection="Ascending" TotalRowCount="0" MouseOverColor="">
                <HeaderStyle Wrap="False" />
                <AlternatingRowStyle BackColor="AliceBlue" />
                <RowStyle BackColor="White" />
                <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
                <Columns>
                    <asp:TemplateField ShowHeader="False">
                        <itemtemplate>
                            <asp:LinkButton ID="lbtnDelete" runat="server" CausesValidation="False" OnClick="lbtnDelete_Click"
                                OnClientClick="<%$ Resources:DeleteConfirm %>" Text="<%$ Resources:Delete %>"
                                CommandName="Delete" Visible='<%# Eval("CanDelete") %>'></asp:LinkButton>
                        </itemtemplate>
                        <itemstyle horizontalalign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="<%$ Resources:File %>">
                        <itemtemplate>
                            <asp:LinkButton ID="lbtnDownLoadFile" runat="server" OnClick="lbtnDownLoadFile_Click"
                                Text='<%# Eval("FileName") %>'></asp:LinkButton>
                            <br />
                            <asp:Label ID="Label3" runat="server" Font-Italic="True" 
                                Text='<%# Server.Mappath(Eval("FileSavePath")) %>'></asp:Label>
                        </itemtemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="FileType" Visible="False" />
                    <asp:TemplateField SortExpression="FileDesc">
                        <itemtemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("FileDesc") %>'></asp:Label>
                        </itemtemplate>
                        <edititemtemplate>
                            <asp:TextBox ID="TextBox1" runat="server" MaxLength="100" 
                                Text='<%# Bind("FileDesc") %>'></asp:TextBox>
                        </edititemtemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False">
                        <itemtemplate>
                            <asp:LinkButton ID="lbtnManageRole" runat="server" CausesValidation="False" CommandName="Select"
                                Text="<%$ Resources:ManageRole %>"></asp:LinkButton>
                        </itemtemplate>
                        <itemstyle horizontalalign="Center" width="100px" />
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False">
                        <itemtemplate>
                            <asp:LinkButton ID="lbtnEdit" runat="server" CausesValidation="False" CommandName="Edit"
                                Text="<%$ Resources:Edit %>"></asp:LinkButton>
                        </itemtemplate>
                        <edititemtemplate>
                            <asp:LinkButton ID="lbtnUpdate" runat="server" CommandName="Update" Text="<%$ Resources:Update %>"></asp:LinkButton>
                            &nbsp;<asp:LinkButton ID="lbtnCancel" runat="server" CausesValidation="False" CommandName="Cancel"
                                Text="<%$ Resources:Cancel %>"></asp:LinkButton>
                        </edititemtemplate>
                        <itemstyle horizontalalign="Center" />
                    </asp:TemplateField>
                </Columns>
            </My:MyGridView>
            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="BLL_DeleteAuth"
                InsertMethod="BLL_InsertAuth" OldValuesParameterFormatString="original_{0}" SelectMethod="BLL_SelectAuth"
                TypeName="BLL_Sys_UpLoadFiles" UpdateMethod="BLL_UpdateAuth">
                <DeleteParameters>
                    <asp:Parameter DbType="Guid" Name="Original_FileSaveName" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter DbType="Guid" Name="Original_FileSaveName" />
                    <asp:Parameter Name="FileDesc" Type="String" />
                </UpdateParameters>
                <SelectParameters>
                    <asp:Parameter Name="theClass" Type="String" />
                    <asp:Parameter Name="theType" Type="String" />
                    <asp:Parameter Name="LoginUser" Type="String" />
                </SelectParameters>
                <InsertParameters>
                    <asp:Parameter Name="theClass" Type="String" />
                    <asp:Parameter Name="theType" Type="String" />
                    <asp:Parameter Name="FileName" Type="String" />
                    <asp:Parameter Name="FileShortName" Type="String" />
                    <asp:Parameter Name="FileType" Type="String" />
                    <asp:Parameter Name="FileSavePath" Type="String" />
                    <asp:Parameter Name="FileSaveName" DbType="Guid" />
                    <asp:Parameter Name="FileDesc" Type="String" />
                    <asp:Parameter Name="CreateBy" Type="String" />
                    <asp:Parameter Name="RoleID" Type="Int32" />
                    <asp:Parameter Name="CanRead" Type="Boolean" />
                    <asp:Parameter Name="CanDelete" Type="Boolean" />
                </InsertParameters>
            </asp:ObjectDataSource>
        </td>
    </tr>
</table>
